import Vue from 'vue'
import Router from 'vue-router'

import login from '@/components/login_components/login'
import forget from '@/components/login_components/forget'
import register from '@/components/login_components/register'
import complete from '@/components/login_components/complete'
import material from '@/components/login_components/material'
import home from '@/components/home'
import chipsList from '@/components/chips_list'
import userMessage from '@/components/user_message'
import chipsDetails from '@/components/chips_details'
import support from '@/components/support'
import successHint from '@/components/success_hint'
import user_collect from '@/components/user_collect'
import user_favorite from '@/components/user_favorite'
import user_support from '@/components/user_support'
import user_binding from '@/components/user_binding'
import supportDetails from '@/components/support_details'
import setMessage from '@/components/set_message'
import apply from '@/components/apply'
import directPay from '@/components/direct_pay'
import userChipsMessage from '@/components/user_chilp_details'
import userBindPhone from '@/components/user_bind_phone'
import wxAuthorization from '@/components/wx_authorization'//微信授权页

Vue.use(Router)
export default new Router({
  routes: [
    {
      path:'/',
      redirect:'/login'
    },
    {
      path: '/login',
      name: 'login',
      component: login
    },
    {
      path: '/forget',
      name: 'forget',
      component: forget
    },
    {
      path: '/register',
      name: 'register',
      component: register
    },
    {
      path: '/complete',
      name: 'complete',
      component: complete
    },
    {
      path: '/material',
      name: 'material',
      component: material
    },
    {
      path: '/home',
      name: 'home',
      component: home,
      children: [
        { path: '/home/chips_list', component: chipsList },
        { path: '/home/user_message', component: userMessage }
      ]
    },
    {
      path: '/chips_details/:activeId',
      name: 'details',
      component: chipsDetails
    },
    {
      path: '/support/:activeId',
      name: 'support',
      component: support
    },
    {
      path: '/success_hint/:activeId',
      name: 'successHint',
      component: successHint
    },
    {
      path: '/user_collect/:identity',
      name: 'user_collect',
      component: user_collect
    },
    {
      path: '/user_favorite',
      name: 'user_favorite',
      component: user_favorite
    },
    {
      path: '/user_support',
      name: 'user_support',
      component: user_support
    },
    {
      path: '/user_binding',
      name: 'user_binding',
      component: user_binding
    },
    {
      path: '/support_details/:activeId',
      name: 'supportDetails',
      component: supportDetails
    },
    {
      path: '/set_message/:activeId',
      name: 'setMessage',
      component: setMessage
    },

    {
      path: '/apply/:activeId',
      name: ' ',
      component: apply
    },
    {
      path: '/direct_pay/:activeId',
      name: 'directPay',
      component: directPay
    },

    {
      path: '/users/chipl_message/:openId',
      component: userChipsMessage
    },
    {
      path: '/user/user_bind_phone',
      name: 'userBindPhone',
      component: userBindPhone
    },
    {
      path: '/wx_authorization/:wxmessage',
      name: 'wx_authorization',
      component: wxAuthorization
    }
  ],
  scrollBehavior(to, from, savedPosition) {
    // ...每次路由切换页面滚动到顶部
    return { x: 0, y: 0 }
  }
})
